import 'package:get/get.dart';
import 'package:shudu/utils/history_model.dart';
import 'package:shudu/utils/share_preference.dart';

class HistoryViewModel extends GetxController {
  final records = [].obs;

  @override
  void onInit() {
    List list = SharePreference.getHistoryRecord();
    List _records = [];
    for (Map<String, dynamic> map in list) {
      HistoryModel model = HistoryModel.fromJson(map);
      _records.add(model);
    }

    records.assignAll(_records);
  }
}
